package com.kaili.tms.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.kaili.common.response.CommonStatus;
import com.kaili.common.response.RestStatus;
import com.kaili.tms.mapper.ShiftsRulesMapper;
import com.kaili.tms.pojo.dto.ShiftsRulesQueryDTO;
import com.kaili.tms.pojo.entity.ExportShiftsRules;
import com.kaili.tms.pojo.entity.ShiftsRulesEntity;
import com.kaili.tms.pojo.vo.RouteCodeOrNameVO;
import com.kaili.tms.pojo.vo.ShiftsRulesVO;
import com.kaili.tms.service.ShiftsRulesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Desc: 班次维护
 * @author: zengshuai
 * @Time: 19-2-19 上午9:32
 * @Copyright: © 2018 杭州凯立通信有限公司 版权所有
 * @Warning: 本内容仅限于公司内部传阅, 禁止外泄或用于其它商业目的
 */
@Service
public class ShiftsRulesServiceImpl implements ShiftsRulesService {

    @Autowired
    private ShiftsRulesMapper shiftsRulesMapper;

    @Override
    public Page<ShiftsRulesVO> queryShiftsRules(Page<ShiftsRulesVO> page, ShiftsRulesQueryDTO queryDTO) {
        List<ShiftsRulesVO> list = shiftsRulesMapper.queryShiftsRules(page, queryDTO);
        return page.setRecords(list);
    }

    @Override
    public Integer addShiftsRules(ShiftsRulesEntity addDTO) {
        return shiftsRulesMapper.addShiftsRules(addDTO);
    }

    @Override
    public Integer updateShiftsRules(ShiftsRulesEntity updateDTO) {
        return shiftsRulesMapper.updateShiftsRules(updateDTO);
    }

    @Override
    public Integer deleteShiftsRules(Long id) {
        return shiftsRulesMapper.deleteShiftsRules(id);

    }

    @Override
    public String getTrainNum() {
        Long num = shiftsRulesMapper.getTrainNum();
        return "PB"+num;
    }

    @Override
    public List<RouteCodeOrNameVO> getRouteCodeOrName(String code) {
        return shiftsRulesMapper.getRouteCodeOrName(code);
    }

    @Override
    public List<ExportShiftsRules> queryShiftsRulesExport(Map<String, Object> map) {
        List<ExportShiftsRules> list = shiftsRulesMapper.queryShiftsRulesExport(map);
        return list;
    }
}
